<template>
  <div class="movie-card">
    <img :src="movie.cover" alt="电影封面" class="movie-cover" v-if="movie.cover" />
    <div class="movie-info">
      <h3 class="title">{{ movie.title }}</h3>
      <p><strong>导演:</strong> {{ movie.director }}</p>
      <p><strong>演员:</strong> {{ movie.actors }}</p>
      <p><strong>简介:</strong> {{ movie.description }}</p>
      <a :href="movie.playUrl" target="_blank" v-if="movie.playUrl" class="play-button">播放</a>
    </div>
  </div>
</template>
  
<script setup lang="ts">
interface Movie {
  title: string
  director: string
  actors: string
  description: string
  cover: string
  playUrl: string
}

defineProps({
  movie: {
    type: Object,
    required: true
  }
})
  </script>
  
  <style scoped lang="scss">
  .movie-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    
    &:hover {
      transform: translateY(-10px);
      box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    }
  }
  
  .poster-container {
    position: relative;
    height: 320px;
    overflow: hidden;
  }
  
  .poster-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 100px;
    font-weight: bold;
  }
  
  .poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
    
    .movie-card:hover & {
      transform: scale(1.05);
    }
  }
  
  .rating {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
  }
  
  .movie-info {
    padding: 20px;
  }
  
  .title {
    font-size: 20px;
    margin-bottom: 8px;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .year {
    color: #7f8c8d;
    margin-bottom: 12px;
    font-size: 16px;
  }
  
  .genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .genre {
    background: #f1f2f6;
    color: #7f8c8d;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
  }
  
  @media (max-width: 768px) {
    .poster-container {
      height: 280px;
    }
    
    .title {
      font-size: 18px;
    }
  }
  </style>